package com.mccraywebtech.services.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.mccraywebtech.dao.GenericDAO;
import com.mccraywebtech.models.Contact;
import com.mccraywebtech.services.GenericService;

@Service("contactService")
public class ContactServiceImpl implements GenericService<Contact> {
	@Autowired
	@Qualifier("contactDAO")
	private GenericDAO<Contact> contactDAO;

	/**
	 * @return the contractDAO
	 */
	public GenericDAO<Contact> getContactDAO() {
		return contactDAO;
	}

	/**
	 * @param contractDAO
	 *            the contractDAO to set
	 */
	public void setContactDAO(GenericDAO<Contact> contactDAO) {
		this.contactDAO = contactDAO;
	}

	@Override
	public void saveObject(Contact c) {
		// TODO Auto-generated method stub
		this.getContactDAO().saveObject(c);
	}

	@Override
	public void updateObject(Contact c) {
		// TODO Auto-generated method stub
		this.getContactDAO().updateObject(c);
	}

	@Override
	public void deleteObject(int id) {
		// TODO Auto-generated method stub
		this.getContactDAO().deleteObject(id);
	}

	@Override
	public Contact getObject(int id) {
		// TODO Auto-generated method stub
		return (Contact) this.getContactDAO().getObject(id);
	}

	@Override
	public List<Contact> getAllObjects() {
		// TODO Auto-generated method stub
		System.out.println("In service...");
		return this.getContactDAO().getAllObjects();
	}

	@Override
	public Contact getByUsername(String username) {
		// TODO Auto-generated method stub
		return null;
	}
}
